Losing connectivity when OpenVPN cannot establish tunnel under Windows
Hi,
We are using OpenVPN to build up and tear down connections on-the-fly in a service of our own. In particular, we have certain routers which are running a Debian distribution on one end, and client side, the users are running Windows, where our service runs (not only do we need to be able to run OpenVPN instances, but we also have to manipulate the routing tables, so we need administrative access, which is why we use a service, as not all of our users run with admin privileges).
With OpenVPN 2.0.9, I was noticing on my Vista dev system that occasionally I'd lose all Internet access - access to anything outside my own subnet. I was able to pin this down to the use of OpenVPN causing some problems when I would attempt to open a tunnel to a router for which I had already recently opened and closed a tunnel. Or so I thought.
I switched to 2.1_rc19 to see if the problem had been addressed, and it seemingly had. I noticed today, however, that I had lost Internet connectivity once more upon attempting to create a tunnel - only this time (or perhaps, I was looking more closely this time?) it was when I was attempting to create a tunnel to a router that was not online. Ipconfig /renew restores the network, and sure enough, attempting to establish that tunnel again, when nothing is on the other side, is causing my networking to die the second time I attempt to establish the tunnel. Windows seems to be forgetting about its default gateway or something, as I can't go anywhere outside the local subnet. I've also tested our program on Windows XP installation (separate computer entirely) and the same problem occurred: second attempt to establish OpenVPN tunnel to a non-existent router results in loss of connectivity beyond the local subnet.
Has anyone heard of anything like this?
As I'm a complete newb when it comes to the OpenVPN source, does anyone have any suggestions for where I might start looking to address this?
OpenVPN output:
Wed Sep 02 13:57:48 2009 OpenVPN 2.1_rc19 i686-pc-mingw32 [SSL] [LZO2] [PKCS11] built on Jul 16 2009
Wed Sep 02 13:57:48 2009 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Wed Sep 02 13:57:48 2009 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Wed Sep 02 13:57:48 2009 Control Channel MTU parms [ L:1541 D:138 EF:38 EB:0 ET:0 EL:0 ]
Wed Sep 02 13:57:48 2009 Data Channel MTU parms [ L:1541 D:1450 EF:41 EB:4 ET:0 EL:0 ]
Wed Sep 02 13:57:48 2009 Local Options hash (VER=V4): '3514370b'
Wed Sep 02 13:57:48 2009 Expected Remote Options hash (VER=V4):
'239669a8'
Wed Sep 02 13:57:48 2009 Socket Buffers: R=[8192->8192] S=[8192->8192]
Wed Sep 02 13:57:48 2009 UDPv4 link local: [undef]
Wed Sep 02 13:57:48 2009 UDPv4 link remote: 192.168.1.49:15003
Wed Sep 02 13:58:14 2009 TCP/UDP: Closing socket
Wed Sep 02 13:58:14 2009 SIGTERM[hard,] received, process exiting
Wed Sep 02 13:58:35 2009 OpenVPN 2.1_rc19 i686-pc-mingw32 [SSL] [LZO2] [PKCS11] built on Jul 16 2009
Wed Sep 02 13:58:35 2009 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Wed Sep 02 13:58:35 2009 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Wed Sep 02 13:58:35 2009 Control Channel MTU parms [ L:1541 D:138 EF:38 EB:0 ET:0 EL:0 ]
Wed Sep 02 13:58:35 2009 Data Channel MTU parms [ L:1541 D:1450 EF:41 EB:4 ET:0 EL:0 ]
Wed Sep 02 13:58:35 2009 Local Options hash (VER=V4): '3514370b'
Wed Sep 02 13:58:35 2009 Expected Remote Options hash (VER=V4):
'239669a8'
Wed Sep 02 13:58:35 2009 Socket Buffers: R=[8192->8192] S=[8192->8192]
Wed Sep 02 13:58:35 2009 UDPv4 link local: [undef]
Wed Sep 02 13:58:35 2009 UDPv4 link remote: 192.168.1.49:15003
Wed Sep 02 13:59:01 2009 TCP/UDP: Closing socket
Wed Sep 02 13:59:01 2009 SIGTERM[hard,] received, process exiting
After this 2nd attempt, just prior to the penultimate line, my IM software lost connection (the first obvious symptom). Takes a /renew to bring it back up.
The arguments I am passing to OpenVPN are:
--client --dev tun --proto udp --pull --resolv-retry infinite --nobind --persist-key --persist-tun --tun-mtu 1500 --verb 3 --keepalive 10 120 --mute 20 --float --remote 192.168.1.49 15003 --ca "C:\Users\jcullison\AppData\Local\Temp\tmp3F43.tmp" --cert "C:\Users\jcullison\AppData\Local\Temp\tmp3F42.tmp" --key "C:\Users\jcullison\AppData\Local\Temp\tmp3F31.tmp"
(The names of the certificate files change each time.)
Since there is no instance of OpenVPN running on the target router at .49, I don't believe its command line, if it were running, matters.
Regards,
John Cullison
Software Engineer
Industrial Defender - Cyber Risk Protection
<http://www.industrialdefender.com/>
[email protected]...
425-951-3567
FAX: 425-487-2288
Industrial Defender, Inc.
21312 30th Drive SE, Suite 102
Bothell, Washington USA 98021 21312
(c)Copyright 2009 Industrial Defender Inc. owns copyright content of this document and all attachments unless otherwise indicated. All rights reserved. Users of Industrial Defender Inc. software and tools associated with the software such as sales & marketing collateral, presentations, user manuals, training documentation etc. may not republish nor reproduce in whole or in part the information, in any form or by any means, in any manner whatsoever without the prior written permission of Industrial Defender Inc., and any such unauthorized use constitutes copyright infringement. An acknowledgment of the source must be included whenever Industrial Defender Inc. material is copied or published. If you require further information on a permitted use or license to reproduce or republish any material, address your inquiry to Industrial Defender Inc. 16 Chestnut Street, Suite 300, Foxborough, Massachusetts, 02035. Any infringement of Industrial Defender Inc. rights will result in appropriate legal action. Industrial Defender Inc. disclaims any and all liability for any consequences which may result from any unauthorized reproduction or use of this Work whatsoever. www.industrialdefender.com <http://www.industrialdefender.com/>
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
On 09/02/2009 06:29:26 PM, John Cullison wrote:
I noticed today, however, that I had lost Internet
Quoted 10 lines
connectivity once more upon attempting to create a tunnel - only this time (or perhaps, I was looking more closely this time?) it was when I
was attempting to create a tunnel to a router that was not online. Ipconfig /renew restores the network, and sure enough, attempting to establish that tunnel again, when nothing is on the other side, is causing my networking to die the second time I attempt to establish the
tunnel. Windows seems to be forgetting about its default gateway or something, as I can't go anywhere outside the local subnet.
I'm sure it would be helpful to know whether it's a default gateway problem "or something". If you can't get the routing tables out of Windows (about which I treasure my ignorance :-) you could try using ping with and without domain names/dns resolution to find out.
If it's a dns problem, and depending on what "go(ing) anywhere" on "the local subnet" means in Windows, it could be a dns problem. Then see http://support.microsoft.com/kb/311218
referenced from the FAQ
http://openvpn.net/index.php/open-source/faq.html
(Note that this is really a dhcp Windows problem
that typically causes dns problems.)
Note that the dns problem was what your message reminded me of. I've not looked closely at your openvpn log and am not familiar enough to be able to tell offhand if it indicates any sort of problem or not.
You also might try the openvpn users list as this could just be (as above) some sort of MS Windows bug exposed by your particular configuration, which would be good to post so people have a better idea of what your doing.
Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
Hi, Karl,
Thank you for your reply.
"Can't access anything outside the subnet" means that if I try to connect to or interact with anything which does not share the first three octets of my computer's IP address, it fails. For example, using a well known browser, if I attempt to connect to a well known website using its IP address (say http://65.55.12.249/), the browser presents a generic page which indicates that it cannot display the desired page; whereas I can send e-mail messages in a certain well known e-mail client to our well known e-mail server which happens to be running on a system which shares the first three octets of my computer's IP address, and my e-mail server can then forward those messages out across the Internet for me, and I can get responses back -- but only because the e-mail server is not affected by whatever I happen to be suffering once this problem crops up. Instant messaging programs are also instantly disconnected when this problem occurs. Ping is not a valid test for us, as at least one of our firewalls blocks ICMP.
I just ran ipconfig (it's like ifconfig, only for Windows) on my test XP box before and after the problem occurs, and the Default Gateway has indeed gone missing:
Before the second failed OpenVPN connection attempt:
C:\Documents and Settings\jcullison>ipconfig
Windows IP Configuration
Ethernet adapter Wireless Network Connection 2:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 2:
Connection-specific DNS Suffix . : teltone.com
IP Address. . . . . . . . . . . . : 192.168.1.115
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1Ethernet adapter Local Area Connection 39:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 40:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 41:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 42:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 43:
Media State . . . . . . . . . . . : Media disconnected
After the second failed OpenVPN connection attempt:
C:\Documents and Settings\jcullison>ipconfig
Windows IP Configuration
Ethernet adapter Wireless Network Connection 2:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 2:
Connection-specific DNS Suffix . : teltone.com
IP Address. . . . . . . . . . . . : 192.168.1.115
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :Ethernet adapter Local Area Connection 39:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 40:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 41:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 42:
Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection 43:
Media State . . . . . . . . . . . : Media disconnected
(We configure five TAP adapters for OpenVPN.)
So I guess I can stop giving my guess as to what's going on and declare explicitly that something about OpenVPN is clobbering my default gateway setting when it cannot open a tunnel a second time.
I opted for the devel list and not the user list because I figure I may find myself deep in OpenVPN code in the near future, and I am looking for any pointers, hints, suggestions, etc., by any folks who might be knowledgeable on the Windows side of OpenVPN development.
Regards,
John Cullison
Software Engineer
Industrial Defender - Cyber Risk Protection [email protected]...
425-951-3567
FAX: 425-487-2288
Industrial Defender, Inc.
21312 30th Drive SE, Suite 102
Bothell, Washington USA 98021 21312
(c)Copyright 2009 Industrial Defender Inc. owns copyright content of this document and all attachments unless otherwise indicated. All rights reserved. Users of Industrial Defender Inc. software and tools associated with the software such as sales & marketing collateral, presentations, user manuals, training documentation etc. may not republish nor reproduce in whole or in part the information, in any form or by any means, in any manner whatsoever without the prior written permission of Industrial Defender Inc., and any such unauthorized use constitutes copyright infringement. An acknowledgment of the source must be included whenever Industrial Defender Inc. material is copied or published. If you require further information on a permitted use or license to reproduce or republish any material, address your inquiry to Industrial Defender Inc. 16 Chestnut Street, Suite 300, Foxborough, Massachusetts, 02035. Any infringement of Industrial Defender Inc. rights will result in appropriate legal action. Industrial Defender Inc. disclaims any and all liability for any consequences which may result from any unauthorized reproduction or use of this Work whatsoever. www.industrialdefender.com
-----Original Message-----
From: Karl O. Pinc [mailto:[email protected]...]
Sent: Wednesday, September 02, 2009 6:50 PM
To: John Cullison
Cc: [email protected]
Subject: Re: [Openvpn-devel] Losing connectivity when OpenVPN cannot establish tunnel under Windows
On 09/02/2009 06:29:26 PM, John Cullison wrote:
I noticed today, however, that I had lost Internet
Quoted 10 lines
connectivity once more upon attempting to create a tunnel - only this time (or perhaps, I was looking more closely this time?) it was when I
was attempting to create a tunnel to a router that was not online. Ipconfig /renew restores the network, and sure enough, attempting to establish that tunnel again, when nothing is on the other side, is causing my networking to die the second time I attempt to establish the
tunnel. Windows seems to be forgetting about its default gateway or something, as I can't go anywhere outside the local subnet.
I'm sure it would be helpful to know whether it's a default gateway problem "or something". If you can't get the routing tables out of Windows (about which I treasure my ignorance :-) you could try using ping with and without domain names/dns resolution to find out.
If it's a dns problem, and depending on what "go(ing) anywhere" on "the local subnet" means in Windows, it could be a dns problem. Then see http://support.microsoft.com/kb/311218
referenced from the FAQ
http://openvpn.net/index.php/open-source/faq.html
(Note that this is really a dhcp Windows problem
that typically causes dns problems.)
Note that the dns problem was what your message reminded me of. I've not looked closely at your openvpn log and am not familiar enough to be able to tell offhand if it indicates any sort of problem or not.
You also might try the openvpn users list as this could just be (as above) some sort of MS Windows bug exposed by your particular configuration, which would be good to post so people have a better idea of what your doing.
Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
On 09/02/2009 09:39:52 PM, John Cullison wrote:
FWIW, I'm not a developer and may or may not have useful info. I'm just asking the questions I would look into. At some point I'll likely run out of questions.
Ping is not a valid test for
Quoted 2 lines
us,
as at least one of our firewalls blocks ICMP.
You could use a udp ping or something like telnet to port 80 just to keep the complication minimal, but you know your network best.
Quoted 5 lines
I just ran ipconfig (it's like ifconfig, only for Windows) on my test XP
box before and after the problem occurs, and the Default Gateway has indeed gone missing:
The next question is: Is the default gateway being configured via DHCP options that are coming from OpenVPN or is there some other reason why the default gateway is altered? Is it the local openvpn that's supposed to alter the gateway, the remote end, or neither? Your local and remote configs would help here.
Quoted 6 lines
So I guess I can stop giving my guess as to what's going on and declare
explicitly that something about OpenVPN is clobbering my default gateway
setting when it cannot open a tunnel a second time.
Was there no OpenVPN on the other end both tests? Does it take 2 failed connection attempts to exhibit the problem or just failure when there's no answer?
Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
Correct -- a second attempt to communicate with a router whose OpenVPN server instance is not running results in this failure.
By second attempt, I mean a second instance of the openvpn.exe run with the command line arguments I gave in the original mail from our specialized service. I haven't done a huge amount of testing beyond proving a reliable repro scenario. I have not, for example, attempted to interleave successful attempts within the failures to see if that somehow clears up the problem.
Regards,
John Cullison
Software Engineer
Industrial Defender - Cyber Risk Protection [email protected]...
425-951-3567
FAX: 425-487-2288
Industrial Defender, Inc.
21312 30th Drive SE, Suite 102
Bothell, Washington USA 98021 21312
(c)Copyright 2009 Industrial Defender Inc. owns copyright content of this document and all attachments unless otherwise indicated. All rights reserved. Users of Industrial Defender Inc. software and tools associated with the software such as sales & marketing collateral, presentations, user manuals, training documentation etc. may not republish nor reproduce in whole or in part the information, in any form or by any means, in any manner whatsoever without the prior written permission of Industrial Defender Inc., and any such unauthorized use constitutes copyright infringement. An acknowledgment of the source must be included whenever Industrial Defender Inc. material is copied or published. If you require further information on a permitted use or license to reproduce or republish any material, address your inquiry to Industrial Defender Inc. 16 Chestnut Street, Suite 300, Foxborough, Massachusetts, 02035. Any infringement of Industrial Defender Inc. rights will result in appropriate legal action. Industrial Defender Inc. disclaims any and all liability for any consequences which may result from any unauthorized reproduction or use of this Work whatsoever. www.industrialdefender.com
-----Original Message-----
From: Karl O. Pinc [mailto:[email protected]...]
Sent: Thursday, September 03, 2009 8:07 AM
To: John Cullison
Cc: [email protected]
Subject: Re: [Openvpn-devel] Losing connectivity when OpenVPN cannot establish tunnel under Windows
On 09/02/2009 09:39:52 PM, John Cullison wrote:
FWIW, I'm not a developer and may or may not have useful info. I'm just asking the questions I would look into. At some point I'll likely run out of questions.
Ping is not a valid test for
Quoted 2 lines
us,
as at least one of our firewalls blocks ICMP.
You could use a udp ping or something like telnet to port 80 just to keep the complication minimal, but you know your network best.
Quoted 5 lines
I just ran ipconfig (it's like ifconfig, only for Windows) on my test XP
box before and after the problem occurs, and the Default Gateway has indeed gone missing:
The next question is: Is the default gateway being configured via DHCP options that are coming from OpenVPN or is there some other reason why the default gateway is altered? Is it the local openvpn that's supposed to alter the gateway, the remote end, or neither? Your local and remote configs would help here.
Quoted 6 lines
So I guess I can stop giving my guess as to what's going on and declare
explicitly that something about OpenVPN is clobbering my default gateway
setting when it cannot open a tunnel a second time.
Was there no OpenVPN on the other end both tests? Does it take 2 failed connection attempts to exhibit the problem or just failure when there's no answer?
Karl <[email protected]...>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email
______________________________________________________________________